package com.book.controller;


import com.book.pojo.Book;
import com.book.pojo.ChapterContent;
import com.book.result.Result;
import com.book.service.ChapterContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
<<<<<<< HEAD
 * @author cxy
 * @since 2023-10-11 23:22:20
=======
 * @author cc
 * @since 2023-10-11 22:04:59
>>>>>>> a45ef284ff029011b55ef4d830c2b996023ef30c
 */
@RestController
@RequestMapping("/chapter-content")
public class ChapterContentController {
    @Autowired
    private ChapterContentService chapterContentService;

    @PostMapping("addContent")
    public void addContent(@RequestBody ChapterContent chapterContent){
        chapterContentService.addContent(chapterContent);
    }


    //查询章节内容字数根据章节id
    @GetMapping("chapterContentNumber")
    public Result chapterContentNumber(@RequestParam Long id){
        chapterContentService.chapterContentNumber(id);
        return Result.OK();
    }

    //作者修改章节内容
    @PutMapping("updateChapterContent")
    public Result updateChapterContent(@RequestBody ChapterContent chapterContent){
        chapterContentService.updateChapterContent(chapterContent);
        return Result.OK();
    }
}
